package GameLogic
{
	import flash.display.Shape;
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.events.MouseEvent;
	import flash.text.TextField;
	public class ScrollPanel extends Sprite
	{
		private var title:TextField;
		private var content:Sprite;
		private var maskShape:Shape;
		private var bg:Shape;
		private var scrollBtn:Shape;
		private var Sbtn:Sprite ;
		private var md:Boolean;
		private var od:Boolean;
		public function ScrollPanel(_w:int,_h:int,_title:String)
		{
			var border:Shape = new Shape();
			border.graphics.lineStyle(1, 0x9D9999);
			border.graphics.beginFill(0xB3DAA8, 1);
			border.graphics.drawRect(0, 0, _w, _h);
			addChild(border);
			title = new TextField();
			title.text = _title;
			addChild(title);
			title.textColor = 0x212220;
			scrollBtn = new Shape();
			scrollBtn.graphics.beginFill(0x34D10A, 0.8);
			scrollBtn.graphics.drawRect(0, 0, 11, 40);
			Sbtn = new Sprite();
			Sbtn.addChild(scrollBtn);
            addChild(Sbtn);
            scrollBtn.x = _w - 13;
            border.graphics.lineStyle(1, 0x000000);
            border.graphics.moveTo(_w - 13+5, 0);
            border.graphics.lineTo(_w -13 + 5, _h);
			
			Sbtn.addEventListener(MouseEvent.MOUSE_OVER, function(e:Event):void
			{
				od = true;
			});
			Sbtn.addEventListener(MouseEvent.MOUSE_OUT, function(e:Event):void
			{
				//od = false;
			});
			this.addEventListener(MouseEvent.MOUSE_MOVE, function(e:MouseEvent):void
			{ 
				if (od && md)
				{
					Sbtn.y = e.localY;
				}
			});
			addEventListener(MouseEvent.MOUSE_DOWN, function(e:Event):void
			{
				md = true;
			});
			addEventListener(MouseEvent.MOUSE_UP, function(e:Event):void
			{
				md = false;
			});




		}
	}
}